#ifndef DOUBLESPINBOXDELEGATE_H
#define DOUBLESPINBOXDELEGATE_H

#include <QStyledItemDelegate>

class DoubleSpinBoxDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    explicit DoubleSpinBoxDelegate(QObject *parent = 0);

    QWidget* createEditor (QWidget *parent , const QStyleOptionViewItem &option , const QModelIndex &index) const;
    void setEditorData (QWidget *editor, const QModelIndex &index) const;
    void setModelData (QWidget *editor , QAbstractItemModel *model , const QModelIndex &index) const;

public slots:
    void setRange (double rangeStart, double rangeEnd);
    void setDefaultValue (double defaultValue);

protected:
    mutable double m_oldValue;
    double m_rangeStart;
    double m_rangeEnd;
    double m_defaultValue;
};

#endif // DOUBLESPINBOXDELEGATE_H
